﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Client Validation Event.aspx.cs" Inherits="Client_Validation_Event" %>

<%@ Register assembly="Cwing.UI.Validation" namespace="Cwing.UI.Controls" tagprefix="cwvf" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <script type="text/javascript">
            var handler = new ValidationEventHandle("<%=ValidationTextBox1.ClientID %>", "Before");
            handler.Handler = function(r){
                this.Message = "Before Validate Handler";
                return false;
            }      
            
            gvInstance().AddValidationHandle(handler);
            
            var handler2 = new ValidationEventHandle("<%=ValidationTextBox1.ClientID %>", "After");
            handler2.Handler = function(r){
                if(r){
                    this.Message = "After Validate Handler";
                    return false;
                }            
                else{
                    return true;
                }
            }
            
            gvInstance().AddValidationHandle(handler2);
        </script>
    <div>
    
        <cwvf:ValidationTextBox ID="ValidationTextBox1" runat="server" 
            Path="//Control[@ID='Number']" Type="Both" ValidationSummary="ErrorList1"></cwvf:ValidationTextBox>
    
    </div>
    <cwvf:ErrorList ID="ErrorList1" runat="server">
    </cwvf:ErrorList>
    </form>
    <p>
        <input id="Button1" type="button" value="button" onclick="javascript:alert('Validation Result:' + gvInstance().Validate());" /></p>
        
</body>
</html>
